/**
 *
 */

var app = getApp()
Page({
	data: {
		root: app.setting.att_url,
		info: [],
		goods: [],
		pagetitle:'提现' + '-' + app.setting.title,
		bannerHeight: Math.ceil(290.0 / 750.0 * getApp().screenWidth)
	},
	onPullDownRefresh: function (){
		var the=this;
		var opt={};
		the.onLoad(opt);
		setTimeout(function(){
			wx.stopPullDownRefresh()
		},1000);
	},
	onLoad: function (options){
		var page=this;
		wx.setNavigationBarTitle({'title':page.data.pagetitle});
		app.util.get(app.access,function(pagedata){
			console.log('tixian');console.log(pagedata);
			page.setData({
				pagedata:pagedata,
			});
		});
	},
	money:function(e){
		var the=this;
		var value=e.detail.value;
		var pagedata=the.data.pagedata
		pagedata.item.service_money=(value*pagedata.setting.percent/100).toFixed(2);
		pagedata.item.cash_money=(value-pagedata.item.service_money).toFixed(2);
		the.setData({
			'pagedata.post.fee':value,
			'pagedata.item':pagedata.item,
		});
	},
	applytype:function(e){
		var the=this;
		var value=e.detail.value;
		the.setData({
			'pagedata.post.type':value,
		});
	},
	bankname:function(e){
		var the=this;
		var value=e.detail.value;
		var pagedata=the.data.pagedata
		var bankname=pagedata.item.banklist[value]
		the.setData({
			'pagedata.post.bankname':bankname,
		});
	},
	//提现
	tixian:function(e){
		var value=e.detail.value;
		var pagedata = this.data.pagedata
		if(value.alipay != value.alipay1){
			app.util.msg('支付宝帐号不一致！');
			return false;
		}
		if(value.bankcard != value.bankcard1){
			app.util.msg('银行卡号不一致！');
			return false;
		}
		pagedata.post.fee = value.fee
		pagedata.post.realname = value.realname
		pagedata.post.alipay = value.alipay
		pagedata.post.bankcard = value.bankcard
		app.util.post('post',pagedata.post)
	},
	click:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.currentTarget.dataset;
		app.util[data.func](data.params);
	},
	click_tab:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.currentTarget.dataset;
		app.util.tab(data.params);
	}
})